package util;

import java.util.Scanner;

public class InputUtil {
    private static final Scanner SC = new Scanner(System.in);

    public static String nextLine() { return SC.nextLine(); }

    public static int nextInt() {
        while (true) {
            try {
                return Integer.parseInt(SC.nextLine());
            } catch (NumberFormatException e) {
                System.out.print("请输入整数：");
            }
        }
    }

    public static double nextDouble() {
        while (true) {
            try {
                return Double.parseDouble(SC.nextLine());
            } catch (NumberFormatException e) {
                System.out.print("请输入数字：");
            }
        }
    }
}